package com.consumer1.controller;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class WarningConsumer {
    /**
     * 接收报警消息
     * @param message
     * @param channel
     */
    @RabbitListener(queues = "warning.queue")
    public void receiveWarningMsg(Message message, Channel channel){
        String msg = new String(message.getBody());
        log.info("报警发现不可路由消息：{}", msg);
    }
}
